package com.mh.shiro.business.enums;

/**
 * @Author: E-mail:
 * @Version: 创建时间：2019年06月20日15:31
 * @Description: <描述>
 */
public enum ResponseStatus {

    SUCCESS(200,"操作成功"),
    ERROR(500,"服务器内部错误"),
    UNAUTHORIZED(500,"尚未登录"),
    FORBIDDEN(500,"您没有操作权限"),
    NOT_FOUND(500,"资源不存在"),
    LOGIN_ERROR(500,"账号和密码错误"),
    USER_EXIST(500,"已存在的用户"),
    INVALID_AUTHCODE(500,"手机验证码无效"),
    INVALID_ACCESS(500,"无效的请求，该请求已过期"),
    DELETE_ERROR(500,"删除无效");

    private Integer code;
    private String message;

    ResponseStatus(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static ResponseStatus getResponseStatus(String message) {
        for (ResponseStatus ut : ResponseStatus.values()) {
            if (ut.getMessage() == message) {
                return ut;
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

}
